﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DLL;
using Module;

namespace BLL
{
    public class BRegionCategory
    {
        #region 字段

        private DRegionCategory APP = new DRegionCategory();//数据操作对象
        private static BRegionCategory instance;

        #endregion

        #region 公共接口
        /// <summary>
        /// 取得
        /// </summary>
        /// <returns>BRegionCategory对象</returns>
        public static BRegionCategory getInstance()
        {
            if (instance == null)
            {
                instance = new BRegionCategory();
            }
            return instance;
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="regionCategoryInfo"></param>
        /// <returns></returns>
        public bool Insert(RegionCategoryInfo regionCategoryInfo)
        {
            if (regionCategoryInfo == null || regionCategoryInfo.RegionCategoryId == 0 || regionCategoryInfo.RegionCategoryId.ToString().Length != 18)
                return false;
            return APP.Insert(regionCategoryInfo);
        }

         /// <summary>
        /// 更新
        /// </summary>
        /// <param name="regionCategoryInfo"></param>
        /// <returns></returns>
        public bool Update(RegionCategoryInfo regionCategoryInfo)
        {
            if (regionCategoryInfo == null || regionCategoryInfo.RegionCategoryId == 0 || regionCategoryInfo.RegionCategoryId.ToString().Length != 18)
                return false;
            return APP.Update(regionCategoryInfo);
        }

        /// <summary>
        /// 根据regionCategoryId删除
        /// </summary>
        /// <param name="regionCategoryId"></param>
        /// <returns></returns>
        public int DeleteByRegionCategoryId(long regionCategoryId)
        {
            if (regionCategoryId == 0 || regionCategoryId.ToString().Length != 18)
                return 0;
            return APP.DeleteByRegionCategoryId(regionCategoryId);

        }

        /// <summary>
        /// 根据FamousRegionId删除
        /// </summary>
        /// <param name="famousRegionId"></param>
        /// <returns></returns>
        public int DeleteByFamousRegionId(long famousRegionId)
        {
             if (famousRegionId == 0 || famousRegionId.ToString().Length != 18)
                return 0;
             return APP.DeleteByFamousRegionId(famousRegionId);
        }

         /// <summary>
        /// 根据famousRegionId获取所有名人专区模块
        /// </summary>
        /// <param name="famousRegionId"></param>
        /// <returns></returns>
        public List<RegionCategoryInfo> GetAllRegionCategoryByFamousRegionId(long famousRegionId)
        {
            if (famousRegionId == 0 || famousRegionId.ToString().Length != 18)
                return null;
            return APP.GetAllRegionCategoryByFamousRegionId(famousRegionId);

        }

        /// <summary>
        /// 根据文章Id获取文章
        /// </summary>
        /// <param name="paperId"></param>
        /// <returns></returns>
        public RegionCategoryInfo GetRegionCategoryInfo(long regionCategoryId)
        {
              if (regionCategoryId == 0 || regionCategoryId.ToString().Length != 18)
                return null;
              return APP.GetRegionCategoryInfo(regionCategoryId);

        }

        /// <summary>
        /// 根据类型获取内容
        /// </summary>
        /// <param name="paperId"></param>
        /// <returns></returns>
        public List<RegionCategoryInfo> GetRegionCategoryListByType(int CategoryType)
        {
            if (CategoryType == 0)
                return null;
            return APP.GetRegionCategoryListByType(CategoryType);
        }
        #endregion
    }
}
